<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<meta http-equiv="Content-Language" content="zh-CN" />
<title>折线图</title>
<script src="js/jquery-1.4.2.min.js"></script>
<script src="js/open-flash-chart/swfobject.js"></script>
<script>
$(function(){
	onload_bar("?file=data@fajia_10-11@28_6.doc@@1", "pic_order_num1");
	$('.span_nian').bind('click', function() {
		$("#nian .current").removeClass("current");
		$(this).addClass("current");
		var v = $(this).attr("rel");
		$("div.bishai").hide();
		$("#"+v).show("slow");
	});
	$('.span_bishai').bind('click', function() {
		$("#every .current").removeClass("current");
		$(this).addClass("current");
		var v = $(this).attr("rel");
		for (i=1;i<=6;i++){
			onload_bar("?file="+v+"@@"+i, "pic_order_num"+i);
		}
	});
	$('.span_nian').first().click();
	$("#qiehuan").bind("click",function(){
		$("#nian,#every").toggle();
	});
});
function onload_bar(s,id){
	if(id==undefined)
		id = "pic_order_num";
	var so_order_num = new SWFObject("js/open-flash-chart/open-flash-chart.swf", "ofc", "600", "400", "9", "#FFFFFF");
	so_order_num.addVariable("data", "doc_go.php"+s);
	so_order_num.addParam("allowScriptAccess", "always" );
	so_order_num.addParam("wmode", "transparent" );
	so_order_num.write(id);
}
</script>
<style>
.span_nian,.span_bishai{color:blue;padding:1px 3px;cursor:pointer;text-decoration:underline;}
.span_nian{color:red;}
.bishai{width:100%;diplay:none;}
.current{background:#ccc;}
#qiehuan{cursor:pointer;}
.bishai span{display:block;float:left;}
</style>
</head>
<body>
<?php 
$data_dir = get_all_files("data");
$all_file = array();
if(!empty($data_dir)){
	foreach ($data_dir as $key => $value) {
		$all_file[$key]["name"] = $value;
		$all_file[$key]["value"] = get_all_files($value);
	}
}
//打印fajia_10-11等等每个文件夹
echo "<div><span id='qiehuan'>切换</span><span id='nian'>";
foreach ($all_file as $value) {
	$temp = str_replace("data/", "", $value["name"]);
	$temp2 = str_replace("/", "_", $value["name"]);
	echo "<span class='span_nian' rel='{$temp2}'>{$temp}</span>";
}
echo "</div>";
//打印每一个比赛
echo "<div id='every'>";
foreach ($all_file as $value) {
	$temp = str_replace("/", "_", $value["name"]);
	echo "<table<tr><td><div class='bishai' id='{$temp}'>";
	foreach ($value["value"] as $v) {
		$temp = str_replace(($value["name"]."/"), "", $v);
		$rel = str_replace("/", "@", $v);
		echo "<span class='span_bishai' rel='{$rel}'>{$temp}</span>";
	}
	echo "</div></td></tr></table>";
}
echo "</div>";
echo "</span>";
?>
	<table>
	<tr>
		<td>
		<div id="pic_order_num1"
			style="padding: 0px; margin: 10px; border: 1px solid lightblue; width: 600px; height: 400px;"></div>
		</td>
		<td>
		<div id="pic_order_num2"
			style="padding: 0px; margin: 10px; border: 1px solid lightblue; width: 600px; height: 400px;"></div>
		</td>
	</tr>
	<tr>
		<td>
		<div id="pic_order_num3"
			style="padding: 0px; margin: 10px; border: 1px solid lightblue; width: 600px; height: 400px;"></div>
		</td>
		<td>
		<div id="pic_order_num4"
			style="padding: 0px; margin: 10px; border: 1px solid lightblue; width: 600px; height: 400px;"></div>
		</td>
	</tr>
	<tr>
		<td>
		<div id="pic_order_num5"
			style="padding: 0px; margin: 10px; border: 1px solid lightblue; width: 600px; height: 400px;"></div>
		</td>
		<td>
		<div id="pic_order_num6"
			style="padding: 0px; margin: 10px; border: 1px solid lightblue; width: 600px; height: 400px;"></div>
		</td>
	</tr>
</table>
</body>
</html>
<?php
/**
 * 取得文件目录下所有文件
 * @param String $path 目录
 */
function get_all_files($path) {
	$list = array ();
	foreach ( glob ( $path . '/*' ) as $item ) {
		$list [] = $item;
	}
	return $list;
}
?>